package com.example.hellodemo;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.example.hellodemo.adapter.AdapterActivity;
import com.example.hellodemo.animation.AnimationActivity;
import com.example.hellodemo.broadcast.BroadActivity;
import com.example.hellodemo.customhttp.HttpActivity;
import com.example.hellodemo.datastorage.DataStorageActivity;
import com.example.hellodemo.gesture.GestureActivity;
import com.example.hellodemo.json.JsonActivity;
import com.example.hellodemo.jump.AAJumpActivity;
import com.example.hellodemo.pageView2.ViewPage2Activity;

public class MainActivity extends AppCompatActivity {
    private Button uiBtn,lifeBtn,jumpBtn,fragementBtn,handerBtn,dataBtn,broadcastBtn,animationBtn,adapterBtn,httpBtn,jsonBtn,gestureBtn
            ,viewpageBtn;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        uiBtn = findViewById(R.id.bt_ui);
        CustomOnClickListers listers = new CustomOnClickListers();
        uiBtn.setOnClickListener(listers);
        lifeBtn = findViewById(R.id.bt_life);
        lifeBtn.setOnClickListener(listers);
        jumpBtn = findViewById(R.id.bt_jump);
        jumpBtn.setOnClickListener(listers);
        fragementBtn = findViewById(R.id.bt_fragement);
        fragementBtn.setOnClickListener(listers);
        handerBtn = findViewById(R.id.bt_hander);
        handerBtn.setOnClickListener(listers);
        dataBtn = findViewById(R.id.bt_data);
        dataBtn.setOnClickListener(listers);
        broadcastBtn = findViewById(R.id.bt_broadcast);
        broadcastBtn.setOnClickListener(listers);
        animationBtn = findViewById(R.id.bt_animation);
        animationBtn.setOnClickListener(listers);
        adapterBtn = findViewById(R.id.bt_adapter);
        adapterBtn.setOnClickListener(listers);
        adapterBtn = findViewById(R.id.bt_http);
        adapterBtn.setOnClickListener(listers);
        jsonBtn = findViewById(R.id.bt_Json);
        jsonBtn.setOnClickListener(listers);
        httpBtn = findViewById(R.id.bt_http);
        httpBtn.setOnClickListener(listers);
        gestureBtn = findViewById(R.id.bt_Gesture);
        gestureBtn.setOnClickListener(listers);
        viewpageBtn = findViewById(R.id.bt_viewPage);
        viewpageBtn.setOnClickListener(listers);


    }

    class CustomOnClickListers implements View.OnClickListener{

        @Override
        public void onClick(View v) {
            Intent intent = null;
            switch (v.getId()){
                case R.id.bt_ui:
                    intent = new Intent(MainActivity.this, UIActivity.class);
                    break;
                case R.id.bt_life:
                    intent = new Intent(MainActivity.this, LifeActivity.class);
                    break;
                case R.id.bt_jump:
                    intent = new Intent(MainActivity.this, AAJumpActivity.class);
                    break;
                case R.id.bt_fragement:
                    intent = new Intent(MainActivity.this, ContainsActivity.class);
                    break;
                case R.id.bt_hander:
                    intent = new Intent(MainActivity.this, HanderActivity.class);
                    break;
                case  R.id.bt_data:
                    intent = new Intent(MainActivity.this, DataStorageActivity.class);

                    break;
                case  R.id.bt_broadcast:
                    intent = new Intent(MainActivity.this, BroadActivity.class);

                    break;
                case  R.id.bt_animation:
                    intent = new Intent(MainActivity.this, AnimationActivity.class);

                    break;
                case R.id.bt_adapter:
                    intent = new Intent(MainActivity.this, AdapterActivity.class);
                    break;
                case R.id.bt_http:
                    intent = new Intent(MainActivity.this, HttpActivity.class);
                case  R.id.bt_Json:
                    intent = new Intent(MainActivity.this, JsonActivity.class);
                    break;
                case  R.id.bt_Gesture:
                    intent = new Intent(MainActivity.this, GestureActivity.class);
                    break;
                case  R.id.bt_viewPage:
                    intent = new Intent(MainActivity.this, ViewPage2Activity.class);
                    break;
            }
            startActivity(intent);
        }
    }
}
